-
Couldn't load subscription status.
- Fork 41.6k
Add configuration property for preferred json mapper in webflux #47419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add configuration property for preferred json mapper in webflux #47419
Conversation
f9943df to
3daa029
Compare
Signed-off-by: Vasily Pelikh <[email protected]>
3daa029 to
2680329
Compare
|
To extend this concept to WebFlux, would it be more consistent to use the existing key "spring.http.converters.preferred-json-mapper" as the common entry point rather than introducing a new one "spring.http.codecs.preferred-json-mapper"? |
Thanks for suggestion. As I understood I also think that merging http-codecs with http-converters might be a good idea, but it is out of scope of this MR. |
|
You're correct, @vpelikh, that property should not be used to influence both HTTP codecs and HTTP message converters. Please leave things as they are and we'll review your proposal more fully in due course. |
|
Thanks for your contribution @vpelikh We discussed this today and we don't think we should introduce such a property, because this property would expose three choices that aren't really applicable to WebFlux applications right now. Let me expand on that. First, the Also, the Kotlin serialization support is somewhat different. This was initially considered as a possible configuration value for this property in MVC, but as seen in #47178 this codec should not be considered for "full JSON" support as it often needs another one for fallback in Kotlin environments. That leaves us with a single option: Jackson. At this point, there is no need to surface this to developers with configuration properties given the current situation. We might revisit this in the future. Thanks! |
|
@bclozel, thanks for the deep explanation! |
Actuator requires Jackson. We do not have any plans to support Kotlin Serialization there. |
Jackson sometimes used as transitive dependency (looking at spring-actuator), so it can casually end up in your classpath without your knowledge. This complicates json codec setup if you want to use something else. Spring-webmvc already have good solution to this problem, so I ported it to webflux. I don't think this is the best implementation, but it's definitely the simplest.
I will be glad to hear any suggestions.